import React from 'react'
import styles from './index.less'
import { Row, Col,Button,Rate } from 'antd'
import {format} from '../../utils'
import driverLogo from '../../../assets/driverLogo.png'
import { config } from '../../utils'
const IMGURL = config.IMGURL
class detail extends React.Component {
    state = {
        ImgUrl:'',
        ImgUrlBon:false
    }
    render() {
    const {detail, onOk,individualVo} =this.props
    const customerType =(e)=>{
      let text =''
      switch(e){
            case 0:
                text = '公司管理员'
                break;
            case 5:
                text = '公司发货员'
                break;
            case 6:
                text = '普通用户'
                break;
            case 9:
                text = '司机'
                break;           
        }
        return text
    }
    const truckType =(e)=>{
        let text = ''
        switch(e){
            case 0:
                text = '小型车'
                break;
            case 5:
                text = '中型车'
                break;
            case 9:
                text = '大型车'
                break;          
        }
        return text
    }
    const ondblclick =(e)=>{
        this.setState({
            ImgUrl:e.target.src,
            ImgUrlBon:true
        });
    }
    const HideImgMax=(e)=>{
        this.setState({
            ImgUrl:'',
            ImgUrlBon:false
        });
    }
    const onGetAut = ()=>{
        const data ={
            id:detail.id,
            type:detail.customerType,
            aut:1
        }
        onOk(data)
    }
    const onFailAut =()=>{
        const data ={
            id:detail.id,
            type:detail.customerType,
            aut:0
        }
        onOk(data)
    }
    const Colstyle ={
        padding:'10px 0 10px 0',
        boxSizing: 'border-box',
    }
    const ColFont = {
        color:'#04021D',
        fontWeight: 'bold',
        paddingRight:5
    }
    const ButtonSH ={
        display:detail.autStatus == '5'?'':'none',
        marginRight:20
    }
    console.log("detail===11",detail)
    const favorableRate = 10
    console.log("favorableRate",favorableRate)
    return (
      <div>
        <div className={styles.filterTop}>
            <div className={styles.title}><span style={{marginRight:20}}>{individualVo.trueName }</span>
                <Button type="primary" style={ButtonSH} onClick={onGetAut} >
                    认证
                </Button>
                <Button style={ButtonSH} onClick={onFailAut} >
                    失败
                </Button>
            </div>
            <div className={styles.Searchright}>
            </div>
        </div>
        <div className={styles.listbox}>
            <Row>
                <Col sm={24} lg={12} xl={10} style={{marginBottom:30}}>
                    <Col span={20} style={Colstyle}><span style={ColFont}>姓名:</span> {individualVo.trueName }</Col>
                    <Col span={20} style={Colstyle}><span style={ColFont}>身份证:</span> {individualVo.idNumber }</Col>
                    <Col span={20} style={Colstyle}><span style={ColFont}>手机号码: </span>{individualVo.mobile }</Col>
                    <Col span={20} style={Colstyle}><span style={ColFont}>客户类型:</span> {customerType(individualVo.customerType) }</Col>
                    <Col span={20} style={Colstyle}><span style={ColFont}>发货权限: </span>{individualVo.empRight ==0?'无权限':'有权限' }</Col>
                    <Col span={20} style={Colstyle}><span style={ColFont}>所属企业 :</span> { individualVo.enterprise }</Col>
                    <Col span={20} style={Colstyle}><span style={ColFont}>车型 : </span>{ truckType(detail.vehicleType) }</Col>
                    <Col span={20} style={Colstyle}><span style={ColFont}>车牌号 : </span>{ truckType(detail.vehicleNo) }</Col>
                    <Col span={20} style={Colstyle}><span style={ColFont}>好评率 : </span> <Rate allowHalf disabled className={styles.CustomRate} defaultValue={favorableRate} /></Col>
                </Col>
                <Col sm={24} lg={12} xl={10} style={{marginBottom:30}}>
                    <Col span={10} style={Colstyle}>
                        <Col span={20} style={Colstyle}><span style={ColFont}>身份证照片 : </span></Col>
                        <Col span={20} style={Colstyle}><img width='100' style={{cursor:'pointer'}} title='双击查看大图' onDoubleClick={ondblclick}  src={ IMGURL+individualVo.idNumberPhoto }></img></Col>
                    </Col>
                    <Col span={10} style={Colstyle}>
                        <Col span={20} style={Colstyle}><span style={ColFont}>驾驶证照片 : </span></Col>
                        <Col span={20} style={Colstyle}><img width='100' style={{cursor:'pointer'}} title='双击查看大图' onDoubleClick={ondblclick}  src={ IMGURL+individualVo.driversLicense }></img></Col>
                    </Col>
                    <Col span={10} style={Colstyle}>
                        <Col span={20} style={Colstyle}><span style={ColFont}>车俩合影 : </span></Col>
                        <Col span={20} style={Colstyle}><img width='100' style={{cursor:'pointer'}} title='双击查看大图' onDoubleClick={ondblclick}  src={ IMGURL+detail.vehiclePhoto }></img></Col>
                    </Col>
                    <Col span={10} style={Colstyle}>
                        <Col span={20} style={Colstyle}><span style={ColFont}>行驶照片 : </span></Col>
                        <Col span={20} style={Colstyle}><img width='100' style={{cursor:'pointer'}} title='双击查看大图' onDoubleClick={ondblclick}  src={ IMGURL+detail.vehicleLicense }></img></Col>
                    </Col>
                </Col>
            </Row>

        </div>
        <div onClick={HideImgMax} style={{display:this.state.ImgUrlBon?'':'none'}} className={styles.ImgMax}><img width='600' src={ this.state.ImgUrl }></img></div>
      </div>
    );
  }
}
export default detail
